#include "froze_openhouse.h"



u32	RxEOpenRcd(u32 Code)
{
	u8 *p =;
	static const u32 mvEOpenRcd[] = {
		READ_RAM( vBaseAddr , READ_TIME(TP_SEC, TM_YMDHMS)),
		READ_RAM( (vComData + sizeof(ComData)-12) , READ_TIME(TP_SEC, TM_YMDHMS)),
		READ_RAM( vBaseAddr+4, BCD_OUT( 4, 4, 0)),
		READ_RAM( vBaseAddr+8, BCD_OUT( 4, 4, 0)),
		FILL_RAM( 0, 16),
		READ_RAM( (vComData + sizeof(ComData)-12 +4), BCD_OUT( 4, 4, 0)),
		READ_RAM( (vComData + sizeof(ComData)-12 +8), BCD_OUT( 4, 4, 0)),
		_RET_|FILL_RAM( 0, 16),
	};
	static const u32 mvEOpenRcd2[] = {
		READ_RAM( vBaseAddr , READ_TIME(TP_SEC, TM_YMDHMS)),
		FILL_RAM( 0, 6),
		READ_RAM( vBaseAddr+4, BCD_OUT( 4, 4, 0)),
		READ_RAM( vBaseAddr+8, BCD_OUT( 4, 4, 0)),
		FILL_RAM( 0, 16),
		FILL_RAM(0, 8),
		_RET_|FILL_RAM( 0, 16),
	};
	u16	Addr;
	u8	Type;
	u8	Cnt;
	


	if(RamData.pBase == NUL){
		return ClrpCharRam(60);
	}
	Type = _FROZE_EOPEN_1_ + ((((Code>>8)&0xFF)-0x0D)<<1);
	Cnt = ((Code&0xFF)-1);
	if(FlashInfo.frozeCnt[Type] - FlashInfo.frozeCnt[Type+1]){
		if(Cnt == 0){
			Addr = 0;
		} else {
			Addr = GetFrozeStart(Type+1, (Cnt-1));
		}
	} else {
		Addr = GetFrozeStart(Type+1, Cnt);
	}
		
	if(Addr){
		CopyRam((ComData + sizeof(ComData)-12), (u8*)Addr, 12);
		return MoveDataLst(mvEOpenRcd);
	} else {
		return MoveDataLst(mvEOpenRcd2);
	}
}